package com.rmfyzxfw.caseprocess.boot.handler;

import com.rmfyzxfw.caseprocess.boot.result.ApiResult;
import com.rmfyzxfw.caseprocess.boot.result.CommonStatusCode;
import com.rmfyzxfw.caseprocess.boot.result.R;
import org.springframework.boot.web.servlet.error.ErrorController;
import org.springframework.http.HttpStatus;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import javax.servlet.http.HttpServletResponse;

/**
 * @author lixiaoxiang
 * @Description
 * @createTime 2021年12月26日 16:03:00
 */
@Controller
public class NotFoundExceptionHandler implements ErrorController {

    @RequestMapping("error")
    @ResponseBody
    public ApiResult error(HttpServletResponse response){
        //定义为正常返回
        response.setStatus(HttpStatus.OK.value());
        //自行组织返回数据
        return R.fail(CommonStatusCode._1015);
    }

}
